-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add a symbolize transformer #7307
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #7307 +/- ##
=======================================
Coverage 98.67% 98.67%
=======================================
Files 1111 1113 +2
Lines 97012 97058 +46
=======================================
+ Hits 95729 95775 +46
Misses 1283 1283 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
1d6daf6
to
6d50406
Compare
@NoureldinYosri , phxz symbolizer transformer! Could you help review? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overall looks good but lets make the tag a class instead of a string, for example
@attrs.frozen
class SymbolizeTag:
prefix: str
65fa09f
to
5b20dcc
Compare
Good point, done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM%nit
Copy of the transformed input circuit. | ||
""" | ||
|
||
if not symbolize_tag.prefix: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets move this to the constructor of the tag, see the other comment
|
||
@attr.frozen | ||
class SymbolizeTag: | ||
prefix: str |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prefix: str | |
prefix: str = attrs.field(validator=lambda s: len(s) > 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Symbolizes single qubit gates by tags.
Symbolizes single qubit gates by tags.
Example:
Input:
$ cirq.symbolize_single_qubit_gates_by_indexed_tags(c, tag_prefix="phxz")
Output:
where, a0,x0,z0,a1,x1,z1 are symbols.
Context: to be used in #6994.